All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.table.AbstractTableModel
java.lang.Object
|
+----com.sun.java.swing.table.AbstractTableModel
- public abstract class AbstractTableModel
- extends Object
- implements TableModel, Serializable
This abstract class provides default implementations for most of
the methods in the TableModel interface. It takes care of
the management of listners and provides some conveniences for generating
TableModelEvents and dispatching them to the listeners.
To create a concrete TableModel as a sublcass of
AbstractTableModel you need only provide implementations for the
following three methods:
public int getRowCount();
public int getColumnCount();
public Object getValueAt(int row, int column);
Warning: serialized objects of this class will not be compatible with
future swing releases. The current serialization support is appropriate
for short term storage or RMI between Swing1.0 applications. It will
not be possible to load serialized Swing1.0 objects with future releases
of Swing. The JDK1.2 release of Swing will be the compatibility
baseline for the serialized form of Swing objects.
-
listenerList
- List of listeners
-
AbstractTableModel()
-
-
addTableModelListener(TableModelListener)
-
-
findColumn(String)
- Convenience method for locating columns by name.
-
fireTableCellUpdated(int, int)
- Notify all listeners that the value of the cell at (row, column)
has been updated.
-
fireTableChanged(TableModelEvent)
- Forward the given notification event to all TableModelListeners that registered
themselves as listeners for this table model.
-
fireTableDataChanged()
- Notify all listeners that all cell values in the table's rows may have changed.
-
fireTableRowsDeleted(int, int)
- Notify all listeners that rows in the (inclusive) range
[firstRow, lastRow] have been deleted.
-
fireTableRowsInserted(int, int)
- Notify all listeners that rows in the (inclusive) range
[firstRow, lastRow] have been inserted.
-
fireTableRowsUpdated(int, int)
- Notify all listeners that rows in the (inclusive) range
[firstRow, lastRow] have been updated.
-
fireTableStructureChanged()
- Notify all listeners that the table's structure has changed.
-
getColumnClass(int)
- Returns Object.class by default
-
getColumnCount()
- Returns the number of columns managed by the data source object.
-
getColumnName(int)
- Return a default name for the column using spreadsheet conventions:
A, B, C, ...
-
getRowCount()
- Returns the number of records managed by the data source object.
-
getValueAt(int, int)
- Returns an attribute value for the cell at columnIndex
and rowIndex.
-
isCellEditable(int, int)
- This default implementation returns false for all cells
-
removeTableModelListener(TableModelListener)
-
-
setValueAt(Object, int, int)
- This empty implementation is provided so users don't have to implement
this method if their data model is not editable.
listenerList
protected EventListenerList listenerList
- List of listeners
AbstractTableModel
public AbstractTableModel()
getColumnName
public String getColumnName(int column)
- Return a default name for the column using spreadsheet conventions:
A, B, C, ... Z, AA, AB, etc.
findColumn
public int findColumn(String columnName)
- Convenience method for locating columns by name.
Implementation is naive so this should be overridden if
this method is to be called often. This method is not
in the TableModel interface and is not used by the JTable.
getColumnClass
public Class getColumnClass(int columnIndex)
- Returns Object.class by default
isCellEditable
public boolean isCellEditable(int rowIndex,
int columnIndex)
- This default implementation returns false for all cells
setValueAt
public void setValueAt(Object aValue,
int rowIndex,
int columnIndex)
- This empty implementation is provided so users don't have to implement
this method if their data model is not editable.
addTableModelListener
public void addTableModelListener(TableModelListener l)
removeTableModelListener
public void removeTableModelListener(TableModelListener l)
fireTableDataChanged
protected void fireTableDataChanged()
- Notify all listeners that all cell values in the table's rows may have changed.
The number of rows may also have changed and the JTable should redraw the
table from scratch. The structure of the table, ie. the order of the
columns is assumed to be the same.
- See Also:
- TableModelEvent, EventListenerList
fireTableStructureChanged
protected void fireTableStructureChanged()
- Notify all listeners that the table's structure has changed.
The number of columns in the table, and the names and types of
the new columns may be different from the previous state.
If the JTable recieves this event and its autoCreateColumnsFromModel
flag is set it discards any TableColumns that it had and reallocates
default ones in the order they appear in the model. This is the
same as calling
setModel(TableModel)
on the JTable.
- See Also:
- TableModelEvent, EventListenerList
fireTableRowsInserted
protected void fireTableRowsInserted(int firstRow,
int lastRow)
- Notify all listeners that rows in the (inclusive) range
[firstRow, lastRow] have been inserted.
- See Also:
- TableModelEvent, EventListenerList
fireTableRowsUpdated
protected void fireTableRowsUpdated(int firstRow,
int lastRow)
- Notify all listeners that rows in the (inclusive) range
[firstRow, lastRow] have been updated.
- See Also:
- TableModelEvent, EventListenerList
fireTableRowsDeleted
protected void fireTableRowsDeleted(int firstRow,
int lastRow)
- Notify all listeners that rows in the (inclusive) range
[firstRow, lastRow] have been deleted.
- See Also:
- TableModelEvent, EventListenerList
fireTableCellUpdated
protected void fireTableCellUpdated(int row,
int column)
- Notify all listeners that the value of the cell at (row, column)
has been updated.
- See Also:
- TableModelEvent, EventListenerList
fireTableChanged
protected void fireTableChanged(TableModelEvent e)
- Forward the given notification event to all TableModelListeners that registered
themselves as listeners for this table model.
- See Also:
- addTableModelListener, TableModelEvent, EventListenerList
All Packages Class Hierarchy This Package Previous Next Index